package com.feige.pojo;

import com.baomidou.mybatisplus.annotation.*;
import com.feige.pojo.vo.BaseDeptVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 部门表
 * </p>
 *
 * @author feige
 * @since 2020-10-23
 */
@ApiModel(value="Dept对象", description="部门表")
public class Dept extends BaseDeptVo implements Serializable {

    private static final long serialVersionUID = 1L;


    @ApiModelProperty(value = "祖级列表")
    private String ancestors;


    @NotBlank(message = "负责人不能为空")
    @ApiModelProperty(value = "负责人")
    private String leader;

    @Size(min = 11, max = 11, message = "手机号码长度不能超过或小于11个字符")
    @ApiModelProperty(value = "联系电话")
    private String phoneNumber;

    @Email(regexp = "^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.[a-zA-Z0-9]{2,6}$",message = "邮箱格式不正确")
    @Size(min = 8, max = 50, message = "邮箱长度不能超过50个字符")
    @ApiModelProperty(value = "邮箱")
    private String email;

    @ApiModelProperty(value = "部门状态（1正常 0停用）")
    private Integer status;

    @ApiModelProperty(value = "删除标志（0代表存在 1代表删除）")
    @TableLogic
    private Integer isDelete;

    @ApiModelProperty(value = "创建者")
    @TableField(fill = FieldFill.INSERT)
    private String createBy;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private Date gmtCreate;

    @ApiModelProperty(value = "修改者")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String modifyBy;

    @ApiModelProperty(value = "修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;

    public Dept() {
    }

    public Dept(Long id, String deptName, Long pid, List<BaseDeptVo> children, String ancestors, String leader, String phoneNumber, String email, Integer status, Integer isDelete, String createBy, Date gmtCreate, String modifyBy, Date gmtModified) {
        super(id, deptName, pid, children);
        this.ancestors = ancestors;
        this.leader = leader;
        this.phoneNumber = phoneNumber;
        this.email = email;
        this.status = status;
        this.isDelete = isDelete;
        this.createBy = createBy;
        this.gmtCreate = gmtCreate;
        this.modifyBy = modifyBy;
        this.gmtModified = gmtModified;
    }


    public String getAncestors() {
        return ancestors;
    }

    public void setAncestors(String ancestors) {
        this.ancestors = ancestors;
    }

    public String getLeader() {
        return leader;
    }

    public void setLeader(String leader) {
        this.leader = leader;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(Integer isDelete) {
        this.isDelete = isDelete;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public String getModifyBy() {
        return modifyBy;
    }

    public void setModifyBy(String modifyBy) {
        this.modifyBy = modifyBy;
    }

    public Date getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Date gmtModified) {
        this.gmtModified = gmtModified;

    }

    @Override
    public String toString() {
        return "Dept{" +
                "DeptVo{" +
                "id='" + getId() + '\'' +
                ", deptName='" + getDeptName() + '\'' +
                ", parentId='" + getPid() + '\'' +
                ", children=" + getChildren()+
                '}'+
                ", ancestors='" + ancestors + '\'' +
                ", leader='" + leader + '\'' +
                ", phoneNumber='" + phoneNumber + '\'' +
                ", email='" + email + '\'' +
                ", status=" + status +
                ", isDelete=" + isDelete +
                ", createBy='" + createBy + '\'' +
                ", gmtCreate=" + gmtCreate +
                ", modifyBy='" + modifyBy + '\'' +
                ", gmtModified=" + gmtModified +
                '}';
    }
}
